<?php use PHPCI\Helper\Lang; ?>
<div class="clearfix"  style="margin-bottom: 20px;">
    <div class="pull-right btn-group">
        <a class="btn btn-primary" href="<?php print PHPCI_URL; ?>user/add"><?php Lang::out('add_user'); ?></a>
    </div>
</div>

<div class="row">
	<div class="col-xs-12">
        <div class="box box-primary">

                <table class="table">
                    <thead>
                    <tr>
                        <th><?php Lang::out('email_address'); ?></th>
                        <th><?php Lang::out('name'); ?></th>
                        <th><?php Lang::out('is_admin'); ?></th>
                        <th style="width: 100px"></th>
                    </tr>
                    </thead>
                    <tbody id="users">
                    <?php foreach($users['items'] as $user): ?>
                        <?php
                        switch($user->getIsAdmin())
                        {
                            case 0:
                                $cls = '';
                                $status = Lang::get('no');
                                break;

                            case 1:
                                $cls = 'warning';
                                $status = Lang::get('yes');
                                break;
                        }
                        ?>
                        <tr class="<?php print $cls; ?>">
                            <td><a href="<?php echo PHPCI_URL ?>user/edit/<?php print $user->getId(); ?>"><?php print $user->getEmail(); ?></a></td>
                            <td><?php print htmlspecialchars($user->getName()); ?></td>
                            <td><?php print $status; ?></td>
                            <td>
                                <?php if($this->User()->getIsAdmin()): ?>
                                    <div class="btn-group pull-right">
                                        <a class="btn btn-default btn-small" href="<?php echo PHPCI_URL ?>user/edit/<?php print $user->getId(); ?>"><?php Lang::out('edit'); ?></a>
                                        <button class="btn btn-default btn-small dropdown-toggle" data-toggle="dropdown">
                                            <span class="caret"></span>
                                        </button>
                                        <ul class="dropdown-menu">
                                            <li><a href="<?php echo PHPCI_URL ?>user/delete/<?php print $user->getId(); ?>" class="phpci-app-delete-user"><?php Lang::out('delete_user'); ?></a></li>
                                        </ul>
                                    </div>
                                <?php endif; ?>
                            </td>
                        </tr>
                    <?php endforeach; ?>
                    </tbody>
                </table>
         </div>

	</div>
</div>
